package pack0622;
//数组
public class DemoE {
    public static void main(String[] args) {
        int [] a =new int [5];
        int [] b ={1,2,3,4};
        System.out.println(b[2]);
        //数组的初始化
        int[]c=new int []{3,5,7,9};
        System.out.println(c[0]);
        System.out.println(c[1]);
        System.out.println(c[2]);
        System.out.println(c[3]);
        System.out.println(c.length);
        System.out.println("----------------------");
        c[2]=20;
        for(int i=0;i<c.length;i++)
            System.out.println(c[i]+"\t");

        //齐整数组
        int[][]d=new int [3][3];
        //赋值
        for(int i=0;i<d.length;i++){
            for(int j=0;j<3;j++){
                d[i][j]=i+j;
            }
        }
        //打印
        for(int i=0;i<d.length;i++){
            for(int j=0;j<3;j++){
                System.out.print(d[i][j]+" ");
            }
            System.out.println();
        }
        //非齐整数组
        int[][]e =new int [3][];
        for(int i=0;i<e.length;i++){
            e[i]=new int[i+2];
            for(int j=0;j<e[i].length;j++){
                e[i][j]=i+j;
            }
        }
        //打印
        for(int i=0;i<e.length;i++){
            for(int j=0;j<e[i].length;j++){
                System.out.print(e[i][j]+" ");
            }
            System.out.println();
        }

    }
}
